import React, { Suspense } from 'react';

import { Spin } from 'antd';

// 懒加载组件包装器
const lazyLoadComp = (Component: React.LazyExoticComponent<React.ComponentType<any>>) => {
  return (
    <Suspense
      fallback={
        <div
          style={{
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            height: '200px',
          }}
        >
          <Spin size="large" />
        </div>
      }
    >
      <Component />
    </Suspense>
  );
};

export default lazyLoadComp;
